define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'knscy.comment/index',
        add_url: 'knscy.comment/add',
        edit_url: 'knscy.comment/edit',
        delete_url: 'knscy.comment/delete',
        export_url: 'knscy.comment/export',
        modify_url: 'knscy.comment/modify',
    };

    var Controller = {

        index: function () {
            ea.table.render({
                init: init,
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id',search: false,},
                    {field: 'sort', title: '排序', edit: 'text'},
                    {field: 'nickname', title: '点评人',minWidth:150},
                    {field: 'user_id', title: '用户id',minWidth:150},
                    {field: 'avatar', title: '头像', templet: ea.table.image},
                    {field: 'score', title: '评价分数',minWidth:150,search: false},
                    {field: 'zan', title: '点赞数',minWidth:150,search: false},
                    {field: 'content', title: '内容',minWidth:250, edit: 'text' },
                    {field: 'status', search: 'select',minWidth:150, selectList: ["禁用","启用"], title: '状态', templet: ea.table.switch},
                    {field: 'create_time', title: '创建时间',minWidth:200},
                    {fixed:"right",width:150, title: '操作', templet: ea.table.tool},
                ]],
            });

            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
    };
    return Controller;
});